package com.maxd.modules.selfshop.merchants.controller;

import com.maxd.adapter.IgnoreSecurity;
import com.maxd.error.Result;
import com.maxd.modules.selfshop.merchants.entity.SelfStoreType;
import com.maxd.modules.selfshop.merchants.service.SelfStoreTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value="自营商城店铺商品分类管理",tags={"自营商城店铺商品分类管理"})
@RequestMapping(value = "/self/storeType")
public class SelfStoreTypeController {
    @Autowired
    private SelfStoreTypeService service;

    @IgnoreSecurity
    @GetMapping("/list")
    @ApiOperation("后台列表")
    public Result findAll(Integer page, Integer size, Long storeId) {
        return service.findAll(page, size, storeId);
    }

    @GetMapping("/result")
    @ApiOperation("下拉封装列表")
    public Result result(Long storeId) {
        return service.result(storeId);
    }

    @IgnoreSecurity
    @GetMapping("/findByStore")
    @ApiOperation("不分页列表")
    public Result findByStore(Long storeId) {
        return service.findByStore(storeId);
    }

    @IgnoreSecurity
    @GetMapping("/find")
    @ApiOperation("查询")
    public Result findOne(Long id) {
        return service.findOne(id);
    }

    @IgnoreSecurity
    @PostMapping("/save")
    @ApiOperation("添加")
    public Result saveBody(@RequestBody SelfStoreType entity) {
        return service.saveBody(entity);
    }

    @IgnoreSecurity
    @PostMapping("/update")
    @ApiOperation("修改")
    public Result updateBody(@RequestBody SelfStoreType entity) {
        return service.updateBody(entity);
    }

    @GetMapping("/delete")
    @ApiOperation("删除")
    public Result delete(Long id) {
        return service.delete(id);
    }

}
